<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>嵌套单击</title>
    <style>
        #outerContainer {
            width: 100px; height: 100px;background: blue;
        }
        #innerContainer {width: 50px;height: 50px;background: red;}
    </style>
</head>
<body>
    <div id="outerContainer">
        <div id="innerContainer"></div>
    </div>
    <script>
        const outerContainer = document.getElementById("outerContainer");
        const innerContainer = document.getElementById("innerContainer");
        outerContainer.addEventListener("click", function(e){
            console.log(e.target)
            console.log(this)
        })
        innerContainer.addEventListener("click", function(e){
            // console.log(e.target)
            // console.log(this)
        })
        document.addEventListener("click", ()=>{
            console.log("Document click");
        })
    </script>
</body>
</html>